index_type = type(df.index.values[0]) if not df.empty else None
print(index_type)

key_to_search = 'your_key_here'
if isinstance(key_to_search, index_type):
    result = df.loc[key_to_search]